package com.simplesoftwares.client.library.appskeleton;

import com.google.gwt.user.client.ui.Widget;


/**
 * The Class MenuItems.Repersents a clickable MenuItem.Object of this class sticks on SideBarPanel and NavigationBarPanel
 */
public class MenuItems
{
	
	/** contains reference of widget to be pasted as MenuItem
	  */
	Widget label;
	
	/** Refrence of the screen where the transition will take place when user will  click on MenuItem*/
	AbstractScreen screen;
	
	/** The screen title. Title at screen*/
	String screenTitle;
	
	
	
	/**
	 * Instantiates a new menu items.
	 *
	 * @param label widget to be pasted as menu item
	 * @param screen the redirection screen
	 * @param screenTitle the screen title of the screen
	 */
	public MenuItems(Widget label, AbstractScreen screen,String screenTitle) 
	{
		super();
		this.label = label;
		this.screen = screen;
		this.screenTitle=screenTitle;
	}

	/**
	 * Gets the label.
	 *
	 * @return the label
	 */
	public Widget getLabel() {
		return label;
	}

	/**
	 * Sets the label.
	 *
	 * @param label the new label
	 */
	public void setLabel(Widget label) {
		this.label = label;
	}

	/**
	 * Gets the screen title.
	 *
	 * @return the screen title
	 */
	public String getScreenTitle() {
		return screenTitle;
	}

	/**
	 * Sets the screen title.
	 *
	 * @param screenTitle the new screen title
	 */
	public void setScreenTitle(String screenTitle) {
		this.screenTitle = screenTitle;
	}

	/**
	 * Gets the screen.
	 *
	 * @return the screen
	 */
	public AbstractScreen getScreen() {
		return screen;
	}

	/**
	 * Sets the screen.
	 *
	 * @param screen the new screen
	 */
	public void setScreen(AbstractScreen screen) {
		this.screen = screen;
	}
		
	/**
	 * This method facilitate transition to different screens.It also sets the process name/screen name 
	 * and sets the app in New Mode.
	 */
	public void screenTransition()
	{
		
		AppMemory.getAppMemory().currentState=ScreeenState.NEW;
		AppMemory.getAppMemory().setCurrentScreenandChangeProcessName(screenTitle, screen);
		 screen.changeScreen();
	}
	
}
